home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / setexcept.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  99 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: setexcept.c,v 1.5 1996/10/24 15:50:57 aros Exp $
  4.     $Log: setexcept.c,v $
  5.     Revision 1.5  1996/10/24 15:50:57  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:56:08  digulla
  9.     Replaced AROS_LA by AROS_LHA
  10.     Replaced some AROS_LH*I by AROS_LH*
  11.     Sorted and added includes
  12.  
  13.     Revision 1.3  1996/08/01 17:41:19  digulla
  14.     Added standard header for all files
  15.  
  16.     Desc:
  17.     Lang:
  18. */
  19. #include <exec/execbase.h>
  20. #include <aros/libcall.h>
  21.  
  22. /*****************************************************************************
  23.  
  24.     NAME */
  25.     #include <clib/exec_protos.h>
  26.  
  27.     AROS_LH2(ULONG, SetExcept,
  28.  
  29. /*  SYNOPSIS */
  30.     AROS_LHA(ULONG, newSignals, D0),
  31.     AROS_LHA(ULONG, signalSet,  D1),
  32.  
  33. /*  LOCATION */
  34.     struct ExecBase *, SysBase, 52, Exec)
  35.  
  36. /*  FUNCTION
  37.     Change the mask of signals causing a task exception.
  38.  
  39.     INPUTS
  40.     newSignals - Set of signals causing the exception.
  41.     signalSet  - Mask of affected signals.
  42.  
  43.     RESULT
  44.     Old mask of signals causing a task exception.
  45.  
  46.     NOTES
  47.  
  48.     EXAMPLE
  49.  
  50.     BUGS
  51.  
  52.     SEE ALSO
  53.     AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.  
  59. ******************************************************************************/
  60. {
  61.     AROS_LIBFUNC_INIT
  62.  
  63.     struct Task *me;
  64.     ULONG old;
  65.  
  66.     /* Get pointer to current task */
  67.     me=SysBase->ThisTask;
  68.  
  69.     /* Protect mask of sent signals and task lists */
  70.     Disable();
  71.  
  72.     /* Get returncode */
  73.     old=me->tc_SigExcept;
  74.  
  75.     /* Change exception mask */
  76.     me->tc_SigExcept=(old&~signalSet)|(newSignals&signalSet);
  77.  
  78.     /* Does this change include an exception? */
  79.     if(me->tc_SigExcept&me->tc_SigRecvd)
  80.     {
  81.     /* Yes. Set the exception flag. */
  82.     me->tc_Flags|=TF_EXCEPT;
  83.  
  84.     /* Are taskswitches allowed? (Don't count own Disable() here) */
  85.     if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
  86.         /* No. Store it for later. */
  87.         SysBase->AttnResched|=0x80;
  88.     else
  89.         /* Switches are allowed. Force a rescedule. */
  90.         Switch();
  91.     }
  92.     Enable();
  93.  
  94.     return old;
  95.     AROS_LIBFUNC_EXIT
  96. }
  97.  
  98.  
  99.